package cn.bdqn.applysystem.controller;

import java.util.HashMap;
import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import cn.bdqn.applysystem.entity.Grade;
import cn.bdqn.applysystem.entity.Student;
import cn.bdqn.applysystem.service.GradeService;

import com.alibaba.fastjson.JSON;

@Controller
@RequestMapping("/user")
public class UserController {
	/*
	@Autowired
	@Qualifier("roleServiceImpl")
	*/
	@Autowired
	@Qualifier("gradeServiceImpl")
	GradeService gradeService;
	
	@RequestMapping("/main.html")
	public String main(){
		return "counselor/Indasa";
	}
	
	@RequestMapping(value="/getGradeBySubjectId.json",method=RequestMethod.GET,produces="application/json;charset=utf-8")
	@ResponseBody
	public Object getGradeBySubjectId(@RequestParam Integer subjectId){
		HashMap<String,Object> hashMap = new HashMap<String,Object>();
		List<Grade> gradeList = gradeService.getGradeBySubjectId(subjectId);
		hashMap.put("result",gradeList);
		return JSON.toJSONString(hashMap);
	}
	
	
	
}
